package com.satis.compose.get

import android.annotation.SuppressLint
import androidx.compose.runtime.*
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Dp
import androidx.navigation.NavHostController
import com.google.gson.Gson

/**
 * @author sunshaobei on 2022/9/6
 */

inline val statusBarHeight: Int
    @SuppressLint("InternalInsetResource") @Composable
    get() {
        var statusBarHeight: Int
        with(LocalContext.current) {
            statusBarHeight =
                resources.getDimensionPixelSize(
                    resources.getIdentifier(
                        "status_bar_height",
                        "dimen",
                        "android"
                    )
                )
        }
        return statusBarHeight
    }

inline val statusBarHeightDp: Dp
    @Composable
    get() {
        val statusBarHeightDp:Dp
        var statusBarHeight = statusBarHeight
        with(LocalDensity.current) {
            statusBarHeightDp = statusBarHeight.toDp()
        }
        return statusBarHeightDp
    }

val gson = Gson()